﻿<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        Application.Lock();
        Application.Set("So_Nguoi_Online",0);
        Application.Set("So_Nguoi_Truy_Cap",0);
        
        Application.UnLock();
    }
    
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown

    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs

    }

    void Session_Start(object sender, EventArgs e) 
    {
        Application.Lock();
        Application.Set("So_Nguoi_Online", (int)Application.Get("So_Nguoi_Online") + 1);
        Application.Set("So_Nguoi_Truy_Cap",(int)Application.Get("So_Nguoi_Truy_Cap") + 1);
        Session.Timeout = 30;
        Application.UnLock();
    }

    void Session_End(object sender, EventArgs e) 
    {
        Application.Lock();
        Application.Set("So_Nguoi_Online",(int)Application.Get("So_Nguoi_Online") - 1);
        Application.UnLock();
    }
       
</script>
